package 题目集.前缀和.枚举;

import java.util.Scanner;

//https://www.acwing.com/problem/content/1232/

public class K倍区间朴素做法 {
    static int n;
    static int k;
    static long[] pre;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        n= sc.nextInt();
        k= sc.nextInt();
        pre=new long[n+1];
        for (int i = 1; i < pre.length; i++) {
            pre[i]=sc.nextInt();
            pre[i]+=pre[i-1];
        }
        int res=0;
        for (int i = 1; i < pre.length; i++) {
            for (int j = 0; j < i; j++) {
                if ((pre[i]-pre[j])%k==0){
                    res++;
                }
            }
        }
        System.out.println(res);
    }
}
